package com.c2c.converter;

import com.c2c.po.enums.impl.CommentsState;
import com.c2c.po.enums.impl.GoodiesState;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class GoodiesStateConverter implements Converter<Integer, GoodiesState> {

    @Override
    public GoodiesState convert(Integer integer) {
        for (GoodiesState goodiesState : GoodiesState.values()){
            if (goodiesState.getCode() == integer){
                return goodiesState;
            }
        }
        return null;
    }

}
